﻿--select*from NKNH_L  
CREATE proc [dbo].[NKNH_TongTien]--'112122'  --3400007803    
@so_ctu nvarchar(255)    
as    
select SUM(a.so_tien)as tienVND,SUM(a.ngoaite)as ngoaite,SUM(a.nt_vat)as ngoaite_vat,SUM(a.tien_vat)as tien_vat    
from (select h.so_ctu,l.so_tien,l.ngoaite,l.tien_vat,l.nt_vat from NKNH_H h     
inner join NKNH_L l on h.NHID=l.NHID    
where h.so_ctu=@so_ctu ) a    
group by a.so_ctu  